package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpHRSkillSearchPageUtil extends SeleniumPageUtil{
	public final static By HRS_LINK_SEARCH = By.xpath("//*[@id='2f25f6a1-4540-4ed3-8162-c0b8f0381294']/a");
	
	public final static By HRS_SPAN_HEADER = By.id("ctl44_hdrSearch_lblHeader");
	public final static By HRS_TD_SELECT_WAREHOUSES = By.xpath("//*[@id='tblSearchCriteria']/tbody/tr[1]/td[1]");
	public final static By HRS_SELECT_WAREHOUSES = By.id("ctl44_lbWarehouse");
	public final static By HRS_TD_SELECT_SKILLS = By.xpath("//*[@id='tblSearchCriteria']/tbody/tr[1]/td[4]");
	public final static By HRS_SELECT_SKILLS = By.id("ctl44_lbSkills");
	public final static By HRS_INPUT_SEARCH = By.id("ctl44_btnSearch");
	
	public static void enterHRSkillManagementSearchPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterHRSkillManagementPage();
		SeleniumUtil.waitOnElements(new By[]{HRS_LINK_SEARCH});
		SeleniumUtil.click(SeleniumUtil.getCachedElement(HRS_LINK_SEARCH));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				HRS_SELECT_WAREHOUSES, HRS_SELECT_SKILLS, HRS_INPUT_SEARCH
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(HRS_SELECT_WAREHOUSES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(HRS_SELECT_SKILLS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(HRS_INPUT_SEARCH));
	}
}
